#include "requesthandlerthread.h"
#include "../session/sessionmanager.h"
#include "../session/session.h"

#include <stdio.h>

RequestHandlerThread::RequestHandlerThread(unsigned int session_id,
                        std::string service_name,
                        std::string request_id,
                        std::string request_type,
                        std::string request)
:m_sessionId(session_id),
m_serviceName(service_name),
m_requestId(request_id),
m_requestType(request_type),
m_request(request)
{
   // connect(SessionManager::getInstance()->getSessionByID(session_id), SLOT());
}

RequestHandlerThread::~RequestHandlerThread()
{
}

void RequestHandlerThread::run()
{
    printf("++++++++ Request recieved: +++++++\n reqeust id: %s, \n reqeust_type: %s, \n reqeust: %s \n",
                m_requestId.c_str(), m_requestType.c_str(), m_request.c_str());

    char * response = "I have got you reqeust";
    SessionManager::getInstance()->getSessionByID(m_sessionId)->
                        sendServiceResponse((m_serviceName + "::" + m_requestId),
                                            m_requestType,
                                            0,
                                            response);
}

